<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>JS的算术运算符</title>
</head>

<body>
  <script>
    var n1 = 10
    var n2 = 20

    //计算n1 + n2 的结果，赋值给n3
    var n3 = n1 + n2
    console.log(n3)//当符号两边都是数字或者布尔的时候，会进行数学运算
  </script>

  <script>
    var n1 = '10'
    var n2 = 20
    //计算n1 + n2 的结果，赋值给n3
    var n3 = n1 + n2
    console.log(n3)//只要符号任意一边是字符串的时候，会进行字符串拼接
  </script>
  <!-- 
        -:减法运算
        *：乘法运算
        /：除法运算
        %：取余运算
        4者都只有数学运算功能
     -->
  <script>
    console.log(20 - 10)
    console.log(20 * 10)
    console.log(20 / 8)
    console.log(10 % 3)//结果为余数1
  </script>
</body>

</html>